#include <iostream>
#include <stdio.h>
#include <cmath>
#include <string>
#include <algorithm>
#include <memory.h>

using namespace std;

const double PI = acos(-1.0);
const double eps = 1e-6;
const double INF = 1e9 + 7;



int a[10];


int main()
{
	freopen("data.in", "r", stdin);

	
	memset(a, 0, 10);
	string str;
	int maxNum = 0;

	cin >> str;


	for (int i = 0; i < str.size(); i++)
	{
		a[str[i] - '0']++;
		if (a[str[i] - '0']>maxNum)
		{
			maxNum = a[str[i] - '0'];
		}
	}
	for (int i = 0; i < 10; i++)
	{
		if (a[i] == maxNum)
		{
			cout << i<<","<<maxNum<< endl;
			break;

		}

	}


	system("pause");
	return 0;
}